<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui"
                xmlns:f="http://java.sun.com/jsf/core"
                template="/mytemplate.xhtml">

    <ui:define name="metadata">
    </ui:define>
    <ui:define name="content">
        
        <h:form>
            
            <p:tabView id="view">
                
                <p:tab title="Equipments">
                
                    <p:dataTable var="e" value="#{XMLExportService.equipDM}" 
                                 paginator="true" rows="10"  
                         paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" 
                         selection="#{XMLExportService.selectedEquipments}">  
                        
                            <f:facet name="header">  
                                Selecting Equipments for XML export
                            </f:facet>  
                        
                            <p:column selectionMode="multiple"/>
                            
                            <p:column sortBy="#{e.name}" headerText="Name">  
                                <h:outputText value="#{e.name}" />  
                            </p:column>  

                            <p:column sortBy="#{e.address}" headerText="Address">  
                                <h:outputText value="#{e.address}" />  
                            </p:column>  

                            <p:column sortBy="#{e.type}" headerText="Type">  
                                <h:outputText value="#{e.type}" />  
                            </p:column>  

                            <p:column sortBy="#{e.creationDate}" headerText="Creation date">  
                                <h:outputText value="#{e.creationDate}" />  
                            </p:column>  

                            <p:column sortBy="#{e.modificationDate}" headerText="Modification date">  
                                <h:outputText value="#{e.modificationDate}" />  
                            </p:column> 

                            <p:column sortBy="#{e.objectState}" headerText="State">  
                                <h:outputText value="#{e.objectState}" />  
                            </p:column> 
                            
                            <p:column sortBy="#{e.ports.size()}" headerText="Ports">
                                <h:outputText value="#{e.ports.size()}" />
                            </p:column>
                            
                        </p:dataTable> 
                        
                </p:tab>
                
                <p:tab title="Cables">
                    
                    <p:dataTable var="c" value="#{XMLExportService.cableDM}" 
                                 paginator="true" rows="10"  
                         paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" 
                         selection="#{XMLExportService.selectedCables}">  
                        
                            <f:facet name="header">  
                                Selecting Cables for XML export
                            </f:facet>  
                        
                            <p:column selectionMode="multiple"/>
                            
                            <p:column sortBy="#{c.name}" headerText="Name">  
                                <h:outputText value="#{c.name}" />  
                            </p:column>  

                            <p:column sortBy="#{c.type}" headerText="Type">  
                                <h:outputText value="#{c.type}" />  
                            </p:column>  

                            <p:column sortBy="#{c.creationDate}" headerText="Creation date">  
                                <h:outputText value="#{c.creationDate}" />  
                            </p:column>  

                            <p:column sortBy="#{c.modificationDate}" headerText="Modification date">  
                                <h:outputText value="#{c.modificationDate}" />  
                            </p:column> 

                            <p:column sortBy="#{c.objectState}" headerText="State">  
                                <h:outputText value="#{c.objectState}" />  
                            </p:column> 
                            
                            <p:column sortBy="#{c.cableWires.size()}" headerText="Wires">
                                <h:outputText value="#{c.cableWires.size()}" />
                            </p:column>
                            
                       </p:dataTable> 
                    
                </p:tab>
                
            </p:tabView>
            
            <p:commandButton value = "Export" update="view" ajax="false" actionListener="#{XMLExportService.formXMLFile()}">
                <p:fileDownload value="#{XMLExportService.XMLFile}"/>
            </p:commandButton>
            
        </h:form>
        
    </ui:define>
</ui:composition>
